Searching the index using the Web API

The index can be searched using JSON based queries to the web API allowing access via other clients such as mobile devices, backend servers or custom Javascript.

Server setup

A standalone application is not provided with SearchUnit, however standard integration with a basic web application is all that is required (otherwise the existing demo projects can be used as a starting point).

When the application is setup, verify that the search is working as desired using the web pages.

API

Requests should be as follows:

Note: If you get this error "Request format is unrecognized for URL unexpectedly ending in ..." then you may need to add the HttpPost protocol to the webservices section of web.config, eg.

<configuration>
    <system.web>
    <webServices>
        <protocols>
            <add name="HttpGet"/>
            <add name="HttpPost"/>
        </protocols>
    </webServices>
    </system.web>
</configuration>

Response should be as follows:

JSON
{
    "d": {
        "__type": "SearchResultWrapper:#Keyoti.SearchEngine.Web.AjaxService",
        "Edition": 3,
        "Exception": null,
        "IgnoredWords": [],						//words from the stoplist that were not searched for
        "LiveDataSamples": null,
        "NumberOfResults": 6,						//total number of results available (can be more than returned in 'Results' array below)
        "QueryKeywords": [						//keywords searched for
            "car"
        ],
        "Results": [							//array of search result objects
            {								//result object 1
                "__type": "ResultItem:#Keyoti.SearchEngine.Search",
                "Content": "",						//document content category
                "CustomData": "",					//document Custom Data
                "CustomDataDictionary": [],				//map of Custom Data if CustomData field is a URI encoded string, see Custom Data section for more info
                "KeywordHitMap": [					//information about which words matched in the document
                    {
                        "__type": "KeywordHits:#Keyoti.SearchEngine.Utils",
                        "HitWords": [
                            "car",
                            "cars"
                        ],
                        "Hits": 1,
                        "Keyword": "car"
                    }
                ],
                "Location": null,					//document location category
                "SecurityGroups": [					//document security groups
                    {
                        "__type": "SecurityGroupRecord:#Keyoti.SearchEngine.DataAccess",
                        "Name": "default",
                        "Root": ""
                    }
                ],
                "Summary": "...",					//document result summary
                "Title": "List of cars",				//document title
                "UriString": "http://lo...",				//document URL
                "UriStringAsStored": "http://lo...",			//the document URL as it is stored in the index
                "Weight": 50						//result weight
		}, 
		{							//other result objects
		...
		}
        ],
        "SuggestedSearchExpression": null				//spell check corrected search query if applicable
    }
}

We have not provided exhaustive documentation on this yet, please email support@keyoti.com with any questions and we will be happy to explain in detail.